import request from '@/utils/request'

// 保存临时认证记录 页面和数据
export function insertCertPageRecord(data) {
  return request({
    url: '/ec/certification/insertCertPageRecord',
    method: 'post',
    params: data
  })
}

//查看法人授权书信息
export function legalCertBook() {
  return request({
    url: '/ec/certification/LegalCertBook',
    method: 'get',
  })
}

// 下载法人授权模板
export function genAllAuthBook(companyName,creditCode) {
  return request({
    url: '/ec/certification/genAllAuthBook',
    method: 'get',
    responseType: 'blob',
    params: {companyName:companyName,creditCode:creditCode}
  })
}

// 下载法人授权模板 (手机端专用)
export function genAllAuthBookByMobile(companyName,creditCode) {
  return request({
    url: '/ec/certification/genAllAuthBookByMobile',
    method: 'get',
    params: {companyName:companyName,creditCode:creditCode}
  })
}

// 查询企业认证记录 页面和数据
export function getCertPageRecord(companyId) {
  return request({
    url: '/ec/certification/getCertPageRecord/'+companyId,
    method: 'get'
  })
}

// 撤销法人认证
export function revokeLegalCert(companyId) {
  return request({
    url: '/ec/certification/revokeLegalCert/'+companyId,
    method: 'put'
  })
}

// 修改认证页 法定代表人手机号
export function upLegalPersonMobile(mobile, companyId) {
  return request({
    url: '/ec/certification/upLegalPersonMobile',
    method: 'put',
    params: {mobile: mobile, companyId: companyId}
  })
}


// 重新发送认证通知  员工id
export function againSendMsgLegalCert(companyId) {
  return request({
    url: '/ec/certification/againSendMsgLegalCert/'+companyId,
    method: 'put'
  })
}

// 新增企业认证
export function addCompanyCertification(data) {
  return request({
    url: '/ec/certification',
    method: 'post',
    data: data
  })
}

// 新增法人企业认证
export function addCompanyCertificationLegal(data) {
  return request({
    url: '/ec/certification/certCompany',
    method: 'post',
    data: data
  })
}

// 控制台 修改营业执照
export function updateCompanyCertificationImgPath(data) {
  return request({
    url: '/ec/certification/updateCompanyCertificationImgPath',
    method: 'post',
    data: data
  })
}

// 根据图片地址 ocr 数据
export function businessLicenseIdentify(data) {
  return request({
    url: '/ec/certification/businessLicenseIdentify',
    method: 'post',
    data: data
  })
}

// 根据姓名和手机号进行转交认证
export function certForword(data) {
  return request({
    url: '/ec/certification/certForword',
    method: 'get',
    params: data
  })
}

// 根据企业id 查询企业认证信息
export function getInfoByCompanyId(companyId) {
  return request({
    url: '/ec/certification/companyId/'+companyId,
    method: 'get',
  })
}

// 根据企业id 查询企业认证信息 认证信息中包含oss文件base64文件
export function getInfoByCompanyIdAndOss(companyId) {
  return request({
    url: '/ec/certification/companyIdAndOss/'+companyId,
    method: 'get',
  })
}

// 通用上传方法
export async function uploadBusinessLicense(file) {
  let formData = new FormData();
  formData.append("file", file);
  return request({
    url: '/ec/certification/uploadBusinessLicense'+"?time="+ Math.random(),
    method: 'post',
    data: formData
  })
}

// 根据企业id 查询企业认证信息
export function genLegalCert(companyId) {
  return request({
    url: '/ec/genLegalCert/'+companyId,
    method: 'get',
  })
}

// 法人授权结果页 复制法人授权链接
export function copyLegalSignUrl(companyId) {
  return request({
    url: '/ec/certification/copyLegalSignUrl/'+companyId,
    method: 'get',
  })
}

// 删除付款回单
export function deleteRemitMoneyImg(companyId) {
  return request({
    url: '/ec/certification/deleteRemitMoneyImg/'+companyId,
    method: 'delete',
  })
}

// 企业认证 催一下
export function companyHurry(data) {
  return request({
    url: '/ec/certification/companyHurry',
    method: 'get',
    params: data
  })
}

